package org.example.iris.service.impl;
import org.example.iris.mapper.CompanyMapper;
import org.example.iris.mapper.EnrollMapper;
import org.example.iris.mapper.UploadLogMapper;
import org.example.iris.mapper.UserMapper;
import org.example.iris.entity.DownloadLog;
import org.example.iris.entity.UploadLog;
import org.example.iris.entity.User;
import org.example.iris.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService{
    @Autowired
    private EnrollMapper enrollMapper;

    @Autowired
    private CompanyMapper companyMapper;

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UploadLogMapper uploadLogMapper;

    @Override
    public void acceptCompanyRegistration(int adminId,int companyId) {
        companyMapper.acceptCompanyRegistration(companyId);
        enrollMapper.updateEnrollRecord(adminId, companyId, "accepted");
    }


    @Override
    public void rejectCompanyRegistration(int adminId,int companyId) {
        enrollMapper.updateEnrollRecord(adminId, companyId, "rejected");
    }

    @Override
    public void modifyUser(User user) {
        System.out.println("user update");
        userMapper.update(user);
    }

    @Override
    public void deleteUser(int userId) {
        userMapper.deleteUser(userId);
    }

    @Override
    public List<UploadLog> viewUploadRecords() {
        return uploadLogMapper.selectAll();
    }

    @Override
    public List<DownloadLog> viewDownloadRecords() {
        return List.of();
    }

    @Override
    public void approveForumContent(int postId) {

    }

    @Override
    public void rejectForumContent(int postId, String reason) {

    }
}
